<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mod_equipe extends CI_Model {
	function __construct()
	    {
		parent::__construct();
	    }
        /*retourner les informations de l'équipe*/
        function getAllInfoEquipe($id_cli){
            $sql = "SELECT * FROM equipe WHERE ID_CLI = $id_cli";
            $data=array();
            $Q = $this->db->query($sql);
            if ($Q->num_rows()>0){
                    foreach ($Q->result_array() as $row){
                            $data[]=$row;
                    }
            }
            $Q->free_result();
            return $data;
        }
        /*retourner l'experience de l'equipe*/
        function getExperienceEquipe($id_exp){
            $sql = "SELECT * FROM experience WHERE ID_EXP = $id_exp";
            $data=array();
            $Q = $this->db->query($sql);
            if ($Q->num_rows()>0){
                    foreach ($Q->result_array() as $row){
                            $data[]=$row;
                    }
            }
            $Q->free_result();
            return $data;   
        }
        /*ajout equipe*/
        function addEquipe($data){
            return $this->db->insert('equipe', $data);
        }
        /*update equipe*/
        function updateEquipe($id_com){
            $data = array(
				'ID_COM' => $id_com,
				'ETAT_COM' => 1
			);
	    $this->db->where('ID_COM',$id_com);
	    $this->db->update('commentaire', $data);          
        }
        /*ajout experience*/
        function addExperience($data){
            return $this->db->insert('experience', $data);
        }
        /*update expérience*/
        function updateExperience($id_com){
            $data = array(
				'ID_COM' => $id_com,
				'ETAT_COM' => 1
			);
	    $this->db->where('ID_COM',$id_com);
	    $this->db->update('experience', $data);          
        }
       
}